import React, { Component } from 'react';
import { Table, Form, Input, Row, Col, Select } from 'antd';
import styles from './index.less';

let arrData = [
    {
        key: 'price',
        title: '价格（元）',
        dataIndex: 'price',
        editable: true,
        width: '13%',
    },
    {
        key: 'stock_num',
        title: '库存',
        dataIndex: 'stock_num',
        editable: true,
        width: '13%',
    },
    {
        key: 'code',
        title: '规格编码',
        dataIndex: 'code',
        editable: true,
        width: '13%',
    },
    {
        key: 'cost_price',
        title: '成本价',
        dataIndex: 'cost_price',
        editable: true,
        width: '13%',
    },
    {
        key: 'sale_num',
        title: '销量',
        dataIndex: 'sale_num',
        editable: true,
        width: '10%',
    }
];
class AddSpecification extends Component {
    constructor(props) {
        super(props);

        this.state = {
            // skuListArr: [],
            sku_name_1: {},
            sku_name_1_value: [],
            sku_name_2: {},
            sku_name_2_value: [],
            sku_name_3: {},
            sku_name_3_value: [],
            stock: [],
        }
    }

    compute() {

    }

    componentWillMount() {
        window.Isoption = false;
      }
      componentDidMount() {
        window.Isoption = true;
      }

    render() {
        console.log('this.props.skuListArr....', this.props.skuListArr)
        // let { skuListArr } = this.props.skuListArr;
        // let obj = {};

        // skuListArr.length > 0 && skuListArr.map((item, index) => {
        //     if (index === 0 && item.id) {
        //         obj = {};
        //         obj.id = item.id;
        //         obj.value = item.value;
        //         obj.text = item.text;
        //     }
        // })

        // this.setState({
        //     sku_name_1: obj
        // });

        return (
            <Table
                // components={components}
                className={styles.tableStyle}
                rowKey={record => record.id}
                pagination={false}
                bordered
                dataSource={this.props.dataSource}
                columns={this.props.columns}
                rowClassName="editable-row"
            />
        );
    }
}

export default AddSpecification;
